<?php
namespace app\serverfund\validate;
use \app\manage\validate\BaseValidate;
/**
 * 资金帐户的验证类
 * @author adv30 <adv30@126.com> 2017年6月19日10:44:56
 */
class FundAccount extends BaseValidate
{

    protected $rule = [
        'user_id' => ['integer', 'gt' => '0'],
        'obj_id' => ['integer', 'gt' => '0'],
        'create_ip' => ['ip'],
        'update_ip' => ['ip'],
        'app_id' => ['integer', 'gt' => '0'],
        'money' => ['integer', 'gt' => '0'],
        'opposite_id' => ['integer', 'gt' => '0', 'different' => 'user_id'],
        'borrow_log_id' => ['integer', 'gt' => '0'],
        'freeze_log_id' => ['integer', 'gt' => '0'],
        'user_ids' => ['length'=>'1,256'],
        'exchange' => ['in'=>'Currency,Integral'],
        'money' => ['float', 'egt' => '0.0001'],
        'currency_scale' => ['float','gt'=>'0','requireIf'=>'exchange,Currency'],
        'reason' => ['min'=>5],
    ];
    protected $message = [];
    protected $scene = [
        'init' => ['user_id', 'create_ip', 'app_id'],
        'prepaid' => ['user_id', 'money', 'update_ip', 'app_id'],
        'transfer' => ['user_id', 'opposite_id', 'money', 'update_ip', 'app_id'],
        'payment' => ['user_id', 'opposite_id', 'money', 'update_ip', 'app_id'],
        'borrow' => ['user_id', 'opposite_id', 'money', 'update_ip', 'app_id'],
        'refund' => ['user_id', 'opposite_id', 'money', 'update_ip', 'app_id', 'borrow_log_id'],
        'freeze' => ['user_id', 'opposite_id', 'money', 'update_ip', 'app_id', 'borrow_log_id', 'freeze_log_id'],
        'unfreeze' => ['user_id', 'opposite_id', 'money', 'update_ip', 'app_id', 'borrow_log_id', 'freeze_log_id'],
        'list' => ['page', 'list_rows'],
        'listByUserIds' => ['user_ids'],
        'exchange' => ['exchange', 'money','app_id','currency_scale'],
    ];
}
